import myRequest from '../request.js'
import dicts from '@/config/dicts.js'

// 订单状态统计
export const orderStatusNum = () => {
  return new Promise((resolve, reject) => {
    myRequest(dicts.buyer + '/purchaser/order/order/orderStatus/statistics', 'get').then(res => {
      resolve(res)
    }).catch((err) => {
      reject(err)
    })
  })
}

// 查询钱包余额
export const getwalletBalance = () => {
  return new Promise((resolve, reject) => {
    myRequest(dicts.buyer + '/purchaser/wallet/wallet', 'get').then(res => {
      resolve(res)
    }).catch((err) => {
      reject(err)
    })
  })
}

// 获取会员当前优惠券列表
export const getCurrentCouponList = (params) => {
  return new Promise((resolve, reject) => {
    myRequest(dicts.buyer + '/purchaser/promotion/coupon/getCoupons', 'get', params).then(res => {
      resolve(res)
    }).catch((err) => {
      reject(err)
    })
  })
}

// 获取售后订单 APPLY 
export const getAfterSales = (params) => {
  return new Promise((resolve, reject) => {
    myRequest(dicts.buyer + '/purchaser/order/afterSale/page', 'get', params).then(res => {
      resolve(res)
    }).catch((err) => {
      reject(err)
    })
  })
}

// 获取采购商公司信息
export const getPurchaserInfo = () => {
  return new Promise((resolve, reject) => {
    myRequest(dicts.buyer + '/purchaser/purchaser/address/get/default', 'get').then(res => {
      resolve(res)
    }).catch((err) => {
      reject(err)
    })
  })
}
// 修改密码 
export const changePassword = (val) => {
  return new Promise((resolve, reject) => {
    myRequest(dicts.buyer + '/purchaser/permit/member/modifyPass', 'put', val).then(res => {
      resolve(res)
    }).catch((err) => {
      reject(err)
    })
  })
}
// 联系电话
export const contactTelephone = () => {
  return new Promise((resolve, reject) => {
    myRequest(dicts.essential + '/common/common/im/mobile', 'get').then(res => {
      resolve(res)
    }).catch((err) => {
      reject(err)
    })
  })


}



















